package com.lo.config;

import com.lo.common.VideoInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {


    @Autowired
    private VideoInfo videoInfo;
    //实现添加资源管理器0
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //注册自定义资源处理器
        //对哪些url进行处理(/** 表示对所请求处理)
        registry.addResourceHandler("/**").
                //资源的物理路径（请求url与资源的物理路径进行映射）
                addResourceLocations(
                        "classpath:/META-INF/resources/",
                        "classpath:/resources/",
                        "classpath:/static/",
                        "classpath:/public/",
                        //自定义位置
                        "file:"+videoInfo.getBasePath()+"/");
    }




}
